package com.dongdongshop.service.imp;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbContentCategoryMapper;
import com.dongdongshop.pojo.content.TbContentCategory;
import com.dongdongshop.pojo.content.TbContentCategoryExample;
import com.dongdongshop.service.ContentCategoryServiceI;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class ContentCategoryServiceImpl implements ContentCategoryServiceI {

    @Resource
    private TbContentCategoryMapper contentCategoryMapper;

    @Override
    public void deleteCategory(Long[] ids) {
        contentCategoryMapper.deleteCategory(ids);
    }

    @Override
    public void updateCategory(TbContentCategory contentCategory) {
        contentCategoryMapper.updateByPrimaryKeySelective(contentCategory);
    }

    @Override
    public TbContentCategory getCategory(Long id) {
        return contentCategoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public void insertCategory(TbContentCategory contentCategory) {
        contentCategoryMapper.insertSelective(contentCategory);
    }

    @Override
    public List<TbContentCategory> listCategory() {
        return contentCategoryMapper.selectByExample(new TbContentCategoryExample());
    }
}
